package chapter11;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.*;

/**
 * Created with IntelliJ IDEA.
 * Description:
 *
 * @author lzy
 * @create 2018-03-23 上午8:46
 */
public class ByteArrayStreamTest {
    private static final Logger LOGGER = LoggerFactory.getLogger(ByteArrayStreamTest.class);

    public static void main(String[] args) {
        String str = "www.yootk.com & www.MLDN.com";
        try (InputStream stream = new ByteArrayInputStream(str.getBytes());
             OutputStream outputStream = new ByteArrayOutputStream()) {
            int temp = 0;
            while ((temp = stream.read()) != -1) {
                outputStream.write(Character.toUpperCase(temp));
            }
            LOGGER.info("[change to upper case]:{}", outputStream.toString());
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}
